package com.woniu.dao;

import com.woniu.pojo.Users;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface UsersMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Users record);

    int insertSelective(Users record);

    Users selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Users record);

    int updateByPrimaryKey(Users record);

    @Select(" select * from Users inner join plots p on Users.plot_id = p.id where Users.id=#{id};")
    Users getPersonById(long id);

    @Select("select pass_word from Users where id = ${id}")
    String getPasswordBYID(Long id);

    @Update("update Users  set pass_word=#{newPass} where id=#{id} ")
    int updatePassById(Long id, String newPass);

    @Update("update Users set user_name=#{userName}, birthday=#{birthday},birth_Place=#{birthPlace},phone_number=#{phoneNumber},headimg=#{headimg} where id=#{id}" )
    int updateByOther(Integer id, String userName, String birthday, String birthPlace, String phoneNumber, String headimg);


    @Insert("insert into Users (account, pass_word) values(#{acc},#{pwd}")
    String register(String acc,String pwd);

    @Select("select id,pass_word from Users where account = #{acc}")
    List getPIByAc(String acc);
}